/*
 * XmlUtils.h
 *
 *  Created on: 2013-9-15
 *      Author: wanghua
 */

#ifndef XMLUTILS_H_
#define XMLUTILS_H_

#include "kaka_common.h"

class KKNode;

class XmlUtils {
public:
	XmlUtils();
	virtual ~XmlUtils();

	static TiXmlDocument * readXML(const char* xmlFile);

	static void writeXML(const char* xmlFile, KKNode* node);

	static const char* getStringAttr(TiXmlElement* element,
			const char* attrName, const char* defaultValue);

	static bool getBoolAttr(TiXmlElement* element, const char* attrName,
			bool defaultValue = false);

	static int getIntAttr(TiXmlElement* element, const char* attrName,
			int defaultValue = 0);

	static float getFloatAttr(TiXmlElement* element, const char* attrName,
			float defaultValue = 0);

	static long getLongAttr(TiXmlElement* element, const char* attrName,
			long defaultValue = 0);
};
#endif /* XMLUTILS_H_ */
